/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.res0w.SMMS.admin;

import com.res0w.SMMS.ds.RollCallList;
import com.res0w.SMMS.ds.SettingSchedule;
import com.res0w.SMMS.factory.DataBaseOperate;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author res0w
 * @since 2009-9-23
 * @version 0.1
 * 暂未启用
 *
 *
 */
public class RollCall {

    public ArrayList rollCallItems() {
        ArrayList rct = new ArrayList();
        ResultSet rs = null;
        DataBaseOperate db = new DataBaseOperate();
        String sql = "select * from setting_schedule where isFinished=0";
        try {
            rs = db.dbQueryMuti(sql);
            while (rs.next()) {
                SettingSchedule ssModel = new SettingSchedule();
                ssModel.itemsPriority = rs.getInt("itemsPriority");
                ssModel.itemsName = rs.getString("itemsName").toString().trim();
                ssModel.itemsDate = rs.getString("itemsDate").toString().trim();
                ssModel.itemsLocation =
                        rs.getString("itemsLocation").toString().trim();
                ssModel.isFinished = 0;

                rct.add(ssModel);
            }
        } catch (SQLException ex) {
            Logger.getLogger(RollCall.class.getName()).log(Level.SEVERE, null, ex);
        }
        return rct;
    }

    public ArrayList rollCallStudents(String items) {
        ArrayList rcs = new ArrayList();
        ResultSet rs = null;
        DataBaseOperate db = new DataBaseOperate();
        String sql = "select athleteId,sId,sName,sex,raceNo,groupNo from signup_cachelist " +
                "where joinItems='" + items + "'";
        try {
            rs = db.dbQueryMuti(sql);
            while (rs.next()) {
                RollCallList rc = new RollCallList();
                rc.athleteId = rs.getString("athleteId");
                rc.sId = rs.getString("sId");
                rc.sName = rs.getString("sName");
                rc.sex = rs.getInt("sex");
                rc.raceNo=rs.getInt("raceNo");
                rc.groupNo=rs.getInt("groupNo");

                rcs.add(rc);
            }
        } catch (SQLException ex) {
            Logger.getLogger(RollCall.class.getName()).log(Level.SEVERE, null, ex);
        }
        return rcs;
    }
}
